package website.lhc.admincommo.exceptions;

import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import website.lhc.admincommo.base.Resp;

/**
 * @description:
 * @author: 582895699@qq.com
 * @time: 2021/2/8 下午 11:29
 */
@RestControllerAdvice
public class GlobalExceptionHandle {

    @ExceptionHandler(value = BaseException.class)
    public Resp baseExceptionHandler(BaseException e) {
        return Resp.error("系统异常");
    }

    @ExceptionHandler(value = ConstraintNotMatchException.class)
    public Resp baseExceptionHandler(ConstraintNotMatchException e) {
        return Resp.error(e.getMessage());
    }
}
